Skip to main content
POST
/
v1
/
vouchers
/
{code}
/
validate
curl --request POST \
--url https://{cluster}.voucherify.io/v1/vouchers/{code}/validate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-App-Id: <api-key>' \
--header 'X-App-Token: <api-key>' \
--data '{
"customer": {
"id": "cust_4vMj8Twr5nBzvTrNCgipMb6M"
},
"order": {
"items": [
{
"product_id": "prod_0ba621bae5d39762ce",
"quantity": "1"
},
{
"product_id": "prod_0b661d404787ec6d3b",
"quantity": "1",
"price": 3100
}
]
}
}'
{
"valid": false,
"reason": "redemption does not match validation rules",
"error": {
"code": 400,
"key": "redemption_rules_violated",
"message": "redemption does not match validation rules",
"details": "Gift Card cannot be redeemed because of violated validation rules: val_wvipKm99CJuL",
"request_id": "v-0bccef7a9585cf63b6"
},
"tracking_id": "track_ZGPtmYcM+Mw=",
"code": "vBQvYFEM",
"metadata": {}
}

Authorizations

X-App-Id
string
header
required
X-App-Token
string
header
required
Authorization
string
header
required

The access token received from the authorization server in the OAuth 2.0 flow.

Path Parameters

code
string
required

A code that identifies the voucher.

Example:

"2CpRCE2c"

Body

application/json

Specify the voucher validation context using the request body parameters.

  • Vouchers Validate Discount Request Body
  • Vouchers Validate Gift Request Body
  • Vouchers Validate Loyalty Request Body

Request schema model for validating a voucher using POST v1/vouchers/{code}/validate.

customer
object

Customer's information.

order
object

Order information.

session
object

Schema model for session lock object. The session object is required to establish a session between multiple parallel validation and redemption requests. If you only send the type parameter in the request, then by default the session lock will be established for 7 days. Read more on establishing a validation session.

tracking_id
string
metadata
object
options
object

Response

Returns information whether the voucher is valid in the context of the parameter values provided in the request body.

  • Vouchers Validate Valid Response Body
  • Vouchers Validate Invalid Response Body

Response body schema for POST v1/vouchers/{code}/validate.

valid
boolean
default:true
required

Indicates whether the voucher is valid within the context of the parameters provided in the request body.

code
string
required

Voucher code.

applicable_to
object
required

Contains list of items that qualify in the scope of the discount. These are definitions of included products, SKUs, and product collections. These can be discounted.

inapplicable_to
object
required

Contains list of items that do not qualify in the scope of the discount. These are definitions of excluded products, SKUs, and product collections. These CANNOT be discounted.

metadata
object
required

The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format.

tracking_id
string
required

Hashed order source ID.

campaign
string

Voucher's parent campaign name.

campaign_id
string

Voucher's parent campaign's unique ID.

discount
object

Contains information about discount.

  • Amount
  • Unit
  • Unit Multiple
  • Percent
  • Fixed
gift
object

Gift object response Contains current gift card balance information.

loyalty
object

Contains the cost of reward in points.

reward
object

Contains information about the reward that is being validated.

order
object

Order information.

session
object

Schema model for session lock object. The session object contains information about the session key that was used to establish a session between multiple parallel validation and redemption requests.

start_date
string

Activation timestamp defines when the voucher starts to be active in ISO 8601 format. Voucher is inactive before this date.

expiration_date
string

Expiration timestamp defines when the voucher expires in ISO 8601 format. Voucher is inactive after this date.

I